<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <ul>
        <li>这是li1</li>
        <li>这是li2</li>
        <li>这是li3</li>
        <li>这是li4</li>
        <li>这是li5</li>
        <li>这是li6</li>
        <li>这是li7</li>
        <li>这是li8</li>
        <li>这是li9</li>
        <li>这是li10</li>
    </ul>
    <script>
        var lis = document.querySelectorAll("li");
        // console.log(lis); //[li,li,li]  集合 伪数组

        var arr = [1,2,3,1,2,3];
        // console.log(arr);


        function test(){
            // console.log(arguments); //集合 伪数组

            // 将伪数组转换成真数组
            // var arr1 = [...arguments];
            // console.log(arr1);

            // 推广数组截取的方法更改this指向 返回新数组
            // var arr2 = [].slice.call(arguments);
            // console.log(arr2);

            // 转换成数组
            // var arr3 = Array.from(arguments);
            // console.log(arr3);
        }
        test(12,23,34)

        // 将一组数值转换成数组
        var arr2 = Array.of(23,34,45);
        // console.log(arr2);


        arr = [1,2,3,4,5,6];

        // var arr3 = arr.copyWithin(0,3);
        // console.log(arr3);

        // arr2 = arr.fill("a");
        // console.log(arr2);


        // 拉平  数组扁平化
        arr = [1,2,3,[4,5,6]];
        arr2 = arr.flat();
        console.log(arr2);

        arr = [1,2,3,[4,5,6,[7,8,9]]];
        arr2 = arr.flat(2);
        console.log(arr2);

        arr = [1,2,3,4,5,6];
        arr2 = arr.map(function(item,index,array){
            return [item * 2];
        })
        console.log(arr2);


        arr = [1,2,3];
        arr2 = arr.flatMap(function(item){
            return [[item * 2]];
        })
        console.log(arr2);

        arr = ["a","b","c","d"];
        console.log(arr.at(-1));



    </script>
</body>
</html>